package com.woman.beautylive.domain;

import com.woman.beautylive.data.bean.AnchoBean;
import com.woman.beautylive.data.bean.AnchorSummary;
import com.woman.beautylive.data.bean.BaseResponse;
import com.woman.beautylive.data.bean.GetFriendBean;
import com.woman.beautylive.data.bean.HotAnchorPageBean;
import com.woman.beautylive.data.bean.HotAnchorSummary;
import com.woman.beautylive.data.bean.PageBean;
import com.woman.beautylive.data.bean.PushStreamInfo;
import com.woman.beautylive.data.bean.ThemBean;
import com.woman.beautylive.data.bean.me.UserInfo;
import com.woman.beautylive.data.bean.room.LiveRoomEndInfo;
import com.woman.beautylive.data.bean.room.RoomAdminInfo;
import com.woman.beautylive.data.repository.NewSourceFactory;
import com.woman.beautylive.data.repository.SourceFactory;
import com.woman.beautylive.presentation.ui.main.find.paihangbangbean.MeiLiBangBean;

import java.util.List;

import rx.Observable;

/**
 * @author Muyangmin
 * @since 1.0.0
 */
public class AnchorManager {

    private static final String LIVE_STATUS_ON = "on";
    private static final String LIVE_STATUS_OFF = "off";

    public Observable<BaseResponse<PageBean<AnchorSummary>>> queryAnchors(String condition,
                                                                          int pageNum) {
        return SourceFactory.create().queryAnchors(condition, pageNum);
    }

    public Observable<BaseResponse<PageBean<AnchorSummary>>> loadRecommendAnchors(String token,String time) {
        return SourceFactory.create().loadRecommendAnchors(token,time);
    }
    public Observable<BaseResponse<PageBean<AnchorSummary>>> loadCommendAnchors(String token,String city) {
        return SourceFactory.create().loadCommendAnchors(token,city);
    }

//  关注
    public Observable<BaseResponse<List<HotAnchorSummary>>> loadFollowedLives(int pageNum) {
        return SourceFactory.create().loadFollowedLives(pageNum);
    }

    //  关于话题的列表哦
    public Observable<BaseResponse<List<HotAnchorSummary>>> loadTopicLives(int topicid) {
        return SourceFactory.create().loadTopicLives(topicid);
    }

    /**
     * 查询首页推荐的热门主播列表，附带Banner图片。
     */
    public Observable<BaseResponse<HotAnchorPageBean>> loadHotAnchors(int pageNum) {
        return SourceFactory.create().loadHotAnchors(pageNum);
    }

    /**
     * 查询首页推荐的热门主播列表，附带Banner图片。
     */
    public Observable<BaseResponse<HotAnchorPageBean>> loadHotAnchors(String token,String city,String sex) {
        return SourceFactory.create().loadHotAnchors(token,city,sex);
    }


    public Observable<BaseResponse<Object>> followAnchor(String anchorUid) {
        return SourceFactory.create().followAnchor(anchorUid);
    }

    public Observable<BaseResponse<Object>> unfollowAnchor(String uid) {
        return SourceFactory.create().unfollowAnchor(uid);
    }

    public Observable<BaseResponse<PageBean<AnchorSummary>>> getAnchorFollowings
            (String uid, int pageNum) {
        return SourceFactory.create().getUserStars(uid, pageNum);
    }

    public Observable<BaseResponse<PageBean<AnchorSummary>>> getAnchorFollowees
            (String uid, int pageNum) {
        return SourceFactory.create().getUserFans(uid, pageNum);
    }

    public Observable<BaseResponse<Object>> startLive(String token) {
        return SourceFactory.create().setLiveStatus(token,LIVE_STATUS_ON);
    }

    public Observable<BaseResponse<Object>> stopLive(String token) {
        return SourceFactory.create().setLiveStatus(token,LIVE_STATUS_OFF);
    }

    public Observable<BaseResponse<LiveRoomEndInfo>> getLiveRoomEndInfo(String roomId) {
        return SourceFactory.create().getLiveRoomInfo(roomId);
    }

    public Observable<BaseResponse<Object>> reportLocation(String lat, String lng) {
        return SourceFactory.create().reportLocation(lat, lng);
    }

    public Observable<BaseResponse<PushStreamInfo>> generatePushStreaming(String roomId) {
        return SourceFactory.create().generatePushStreaming(roomId);
    }

    public Observable<BaseResponse<String>> getPlaybackUrl(String roomId) {
        return SourceFactory.create().getPlaybackUrl(roomId);
    }

    public Observable<BaseResponse<AnchoBean>> getAnchoBean(String user_id) {
        return SourceFactory.create().getAnchoBean(user_id);
    }

    public Observable<BaseResponse<ThemBean>> getThemBean(){
        return SourceFactory.create().getThemBean();
    }
    public Observable<BaseResponse<ThemBean>> getThemBean(String title,String number){
        return SourceFactory.create().getThemBean(title,number);
    }

    public Observable<BaseResponse<Object>> postCreatRoom(String token, String title,String roomid,String city,String province) {
        return SourceFactory.create().postCreatRoom(token,title,roomid,city,province);
    }

    public Observable<BaseResponse<String>> starUsr(String token,String uid,String roomid){
        return SourceFactory.create().starUser(token,uid,roomid);
    }

    public Observable<BaseResponse<String>> unStarUsr(String token,String uid,String roomid){
        return SourceFactory.create().unStarUser(token,uid,roomid);
    }

    public Observable<BaseResponse<UserInfo>> getUserInfo(Integer uid){
        return SourceFactory.create().getUserInfo(uid);
    }

    public Observable<BaseResponse<List<GetFriendBean>>> getFriendList(){
        return SourceFactory.create().getFriendList();
    }

    public Observable<BaseResponse<List<MeiLiBangBean>>> getMeiLiBang(int page){
        return NewSourceFactory.create().meilibang(page);
    }
}
